#!/bin/sh

INPUT_DIR="/input"
OUTPUT_DIR="/output"

# Watch for new files in $INPUT_DIR
inotifywait -m -e create --format "%f" "$INPUT_DIR" | while read file
do
  # Process new file with Potrace
  potrace "$INPUT_DIR/$file" -b svg -o "$OUTPUT_DIR/${file%.*}.svg" && \
  rm -f "$INPUT_DIR/$file"  # Delete after processing
done